#include <unistd.h>
#include <signal.h>
#include <sys/time.h>
#include <stdio.h>

int count;

void func(int num)
{
	printf("num: %d\n", num);	
	printf("count: %d\n", count);
	if(count > 0)
	return;	
	
	struct itimerval it;
	struct itimerval val;

	it.it_interval.tv_sec = 1;
	it.it_interval.tv_usec = 0;
	
	it.it_value.tv_sec = 2;
	it.it_value.tv_usec = 0;	

	setitimer(ITIMER_REAL, &it, &val);
	
	count++;
}

int main()
{
	alarm(5);
	signal(SIGALRM, func);	
	while(1);
	return 0;
}
